package cn.edu.scau.cmi.xiaozhenlin.client;

import java.net.URL;

import cn.edu.scau.cmi.xiaozhenlin.simpleFactoryMethod.SimpleFactoryController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class SimpleFactoryMethodClient extends Application {
	Stage stage = new Stage();

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO 自动生成的方法存根
		try {
			URL location = getClass().getResource("../simpleFactoryMethod/SimpleFactoryFx.fxml");
			FXMLLoader fxmlLoader = new FXMLLoader();
			fxmlLoader.setLocation(location);
			fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
			Parent root = fxmlLoader.load();
			Scene scene = new Scene(root);
			scene.getStylesheets()
					.add(getClass().getResource("../simpleFactoryMethod/application.css").toExternalForm());
			primaryStage.setScene(scene);
			SimpleFactoryController simpleFactoryController = fxmlLoader.getController();
			simpleFactoryController.Init();
			primaryStage.setResizable(false);
			primaryStage.setTitle("实现四——简单工厂模式");
			primaryStage.show();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		launch(args);
	}

	public void showWindow() throws Exception {
		start(stage);
	}
}
